<?php
class KomaSystemUserMenu extends KomaBlock
{
    function main()
    {
        global $komaUserHandler;
        
        if ($komaUserHandler->isUser())
        {
            $this->Title = T_('User Menu');
            $this->Template->File = 'usermenu.html';
            $this->Template->assign('viewAccount', T_('View Account'));
            $this->Template->assign('editAccount', new KomaWidgetHyperlink(null, $this->URL.'?action=account',T_('Edit Account')));
            //$this->Template->assign('editAccount', T_('Edit Account'));
            $this->Template->assign('notification', T_('Notification'));
            $this->Template->assign('inbox', T_('Inbox'));
            $this->Template->assign('logout',  T_('Logout'));
            $this->Template->assign('token', $_SESSION['Token']);
            $this->Template->assign('newPrivateMessages', 0);
            
            $query = "SELECT * from ".$this->Database->prefix('priv_msgs')." WHERE to_uid = '".$komaUserHandler->getVar('uid')."'";
            $result = $this->Database->query($query);
        
            if($this->Database->numRows($result))
            {
                $block['new_private_message'] = $this->Database->numRows($result);
            }
            
            return true;
        }
        
        return false;
    }
}
?>
